import request from "@/request/request";
import requestMock from "@/request/requestMock";
//获取三级列表
export const reqCategoryList = () => {
    return request.get('/product/getBaseCategoryList')
}

//获取mock数据
//banner
export const reqBannerList = () => {
    return requestMock.get('/home/banner')
}

//floor
export const reqFloorList = () => {
    return requestMock.get('/home/floor')
}

//请求搜索列表
export const reqSearchList = (searchParams) => {
    return request.post('/list', searchParams)
}

//获取商品详情
export const reqGoodDetail = (skuId) => {
    return request.get(`/item/${skuId}`)
}

//添加到购物车
export const reqAddCart = (skuId, skuNum) => {
    return request.post(`/cart/addToCart/${skuId}/${skuNum}`)
}

//获取购物车列表
export const reqCartList = () => {
    return request.get(`/cart/cartList`)
}

//修改单个商品选中状态
export const reqChangeChecked = (skuId, isChecked) => {
    return request.get(`/cart/checkCart/${skuId}/${isChecked}`)
}

//删除购物车中某个商品
export const reqDeleteCartGood = (skuId) => {
    return request.delete(`/cart/deleteCart/${skuId}`)
}

//批量购物车操作输入框状态
export const reqChangeAllChecked = (isChecked, skuIdList) => {
    return request.post(`/cart/batchCheckCart/${isChecked}`, skuIdList)
}

//删除已选中的商品
export const reqDeleteSelectedGood = (skuIdList) => {
    return request.delete(`/cart/batchDeleteCart`, {
        data: skuIdList
    })
}

//获取手机验证码
export const reqVerifyCode = (phone) => {
    return request.get(`/user/passport/sendCode/${phone}`)
}

//登录
export const reqLogin = (userInfo) => {
    return request.post(`/user/passport/login`, userInfo)
}

//注册接口
export const reqRegister = (userInfo) => {
    return request.post(`/user/passport/register`, userInfo)
}

//获取用户信息
export const reqUserInfo = () => {
    return request.get('/user/passport/auth/getUserInfo')
}

//退出登录
export const reqLogout = () => {
    return request.get(`/user/passport/logout`);
};

//获取订单交易页信息
export const reqOrderTrade = () => {
    return request.get(`/order/auth/trade`)
}

//请求地址信息
export const reqAddress = () => {
    return requestMock.get('/user/userAddress/auth/findUserAddressList')
}

//提交订单
export const reqSubmitOrder = (tradeNo, tradeInfo) => {
    return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, tradeInfo)
}

//获取订单支付信息
export const reqOrderPay = (orderId) => {
    return request.get(`/payment/weixin/createNative/${orderId}`)
}

//查询订单支付状态
export const reqOrderState = (orderId) => {
    return request.get(`/payment/weixin/queryPayStatus/${orderId}`)
}

//获取我的订单列表
export const reqMyOrderList = ({page, limit}) => request.get(`/order/auth/${page}/${limit}`)
